<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.util.Constants,com.hs.core.utils.*" pageEncoding="UTF-8"%>
<%@ page import ="cn.ac.cintcm.dataconverge.researchsubject.domain.*" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Subject obj = (Subject)request.getAttribute("subjectObj");
String url = (String)request.getAttribute("url");
String imagePath = path + "/index/";
Tag oneTag = null;
Tag twoTag = null;
Tag threeTag = null;
Tag fourTag = null;
StringBuffer idStr = new StringBuffer();
if(null != obj){
	oneTag = obj.getOneTag();
	twoTag = obj.getTwoTag();
	threeTag = obj.getThreeTag();
	fourTag = obj.getFourTag();
	idStr.append(oneTag.getId());
	idStr.append(",");
	idStr.append(twoTag.getId());
	idStr.append(",");
	idStr.append(threeTag.getId());
	idStr.append(",");
	idStr.append(fourTag.getId());
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title><%=Constants.APP_TITLE %></title>  
	<script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
	<script language="javascript" src="<%=path %>/index/Scripts/script.js"></script>
	<script language="javascript" src="<%=path %>/js/common.js"></script>
	<link href="<%=path %>/index/Themes/com/style.css" type="text/css" rel="stylesheet"></link>
	<script src='<%=basePath%>dwr/util.js'></script>
    <script type="text/javascript" language="javascript">
    var subjectId = '<%=obj == null?"3":obj.getId()%>';
    function changeTab(tag){
    	var frame = document.getElementById("tabContent");
    	 if("navTd12" == tag){
    	 	frame.src = "<%=path%>/subject.htm?action=gotoAddOrg&subjectId="+subjectId;
    	 } else 
    	 if("navTd13" == tag){
    	 	frame.src = "<%=path%>/subjectToAdd.htm?action=userInfo&subjectId="+subjectId; 
    	 }  else
    	 if("navTd16" == tag){
    	 	frame.src = "<%=path%>/subjectToAdd.htm?action=docInfo&subjectId="+subjectId; 
    	 } 
    	
    } 
	var navTdCacheID2 = "navTd10";
	var navDivCacheID2 = "navDiv10"; 
	function changeNav2(divID,tbID){
	//debugger;
		changeTab(tbID);
		document.getElementById(navDivCacheID2).style.display = 'none';
		document.getElementById(divID).style.display = '';
		document.all(navTdCacheID2+"1").className="tab2_unselect1";
		document.all(navTdCacheID2+"2").className="tab2_unselect2";
		document.all(navTdCacheID2+"3").className="tab2_unselect3";
		document.all(tbID+"1").className="tab2_select1";
		document.all(tbID+"2").className="tab2_select2";
		document.all(tbID+"3").className="tab2_select3";
		
		navTdCacheID2 	= tbID;
		navDivCacheID2 	= divID;
	}
	function saveData(){
	    if(checkForm()){ 
	    	 form2.submit();
	    }
	}
	function checkForm(){
				var fo=document.form2;
				var exp = new RegExp("^[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}$"); 
				if(isNull(fo.projectname.value)){
					alert("请填写项目名称");
					fo.projectname.focus(); 
					return false;
				}
				if(isNull(fo.projectorg.value)){
					alert("请选择项目组织单位");
					fo.projectorg.focus();
					return false;
				}
				if(isNull(fo.subjectname.value)){
					alert("请填写课题名称");
					fo.subjectname.focus();
					return false;
				}
				/*if(isNull(fo.theme.value)){
					alert("请填写主题词");
					fo.theme.focus();
					return false;
				}*/
				if(isNull(fo.applydate.value)){
					alert("请选择申请时间");
					fo.applydate.focus();
					return false;
				}
				
				if(isNull(fo.belongyear.value)){
					alert("请填写课题所属年份");
					fo.belongyear.focus();
					return false;
				}
				/*if(isNull(fo.startdate.value)){
					alert("请填写课题计划开始时间");
					fo.startdate.focus();
					return false;
				}
				if(isNull(fo.enddate.value)){
					alert("请填写课题计划结束时间");
					fo.enddate.focus();
					return false;
				}*/
				if(isNull(fo.comeFrom.value)){
					alert("请选择课题来源");
					fo.comeFrom.focus();
					return false;
				} 
				if(isNull(fo.studyTag.value)){
					alert("请选择学科分级");
					fo.studyTag.focus();
					return false;
				} 
				if(isNull(fo.reasearchNav.value)){
					alert("请选择研究方向");
					fo.reasearchNav.focus();
					return false;
				} 
				if(isNull(fo.reasearchProp.value)){
					alert("请选择研究属性");
					fo.reasearchProp.focus();
					return false;
				} 
				if(isNull(fo.applyfund.value)){
					alert("请填写申请经费"); 
					fo.applyfund.focus();
					return false;
				}
				if(!isDigital(fo.applyfund.value)){
					alert("申请经费填写有误");
					fo.applyfund.focus();
					return false;
				}
				if(!isDigital(fo.permitfund.value)){
					alert("中标经费填写有误");
					fo.permitfund.focus();
					return false;
				}
				if(!isDigital(fo.actualfund.value)){
					alert("实获经费填写有误");
					fo.actualfund.focus();
					return false;
				}
				if(isNull(fo.abstractContent.value)){
					alert("请填写课题概述");
					fo.abstractContent.focus();
					return false;
				} 
				return true;
			}
</script> 

</head>
<body class="rtm_body">
<form name="form2" action="<%=path %>/subjectToAdd.htm?action=onSubmit" method="post">
    <div class="r_rtm_tb_mg1">
        <div class="r_rtm_tb1">
            <img src="<%=imagePath%>/Themes/com/idt_tb_pass.gif" /><span>&nbsp;课题填报</span>
        </div>
    </div>
    <div>
     <table id="Table9" cellspacing="0" cellpadding="0" width="100%" border="0">
            <tr>
                <td class="fw_ptmain_bd_04">
                </td>
                <td class="fw_ptmain_bd_05" align="left" style="height: 155px;">
                    <!--Tab页（标题）-->
                    
                     <!--Tab页（标题）-->
                    <table cellspacing="0" cellpadding="0" id="Table2" width="100%">
                        <tr>
                            <td onclick="changeNav2('navDiv10','navTd10')" class="tab2_select1" id="navTd101">
                            </td>
                            <td onclick="changeNav2('navDiv10','navTd10')" class="tab2_select2" id="navTd102">
                                基本信息</td>
                            <td onclick="changeNav2('navDiv10','navTd10')" class="tab2_select3" id="navTd103">
                            </td>
                            <td onclick="changeNav2('navDiv11','navTd11')" class="tab2_unselect1" id="navTd111">
                            </td>
                            <td onclick="changeNav2('navDiv11','navTd11')" class="tab2_unselect2" id="navTd112">
                                正文内容</td>
                            <td onclick="changeNav2('navDiv11','navTd11')" class="tab2_unselect3" id="navTd113">
                            </td>
                             <%if(null != obj){ %>
                            <td onclick="changeNav2('navDiv12','navTd12')" class="tab2_unselect1" id="navTd121">
                            </td>
                           
                            <td onclick="changeNav2('navDiv12','navTd12')" class="tab2_unselect2" id="navTd122">
                                单位信息</td>
                            <td onclick="changeNav2('navDiv12','navTd12')" class="tab2_unselect3" id="navTd123">
                            </td>
                            <td onclick="changeNav2('navDiv12','navTd13')" class="tab2_unselect1" id="navTd131">
                            </td>
                            <td onclick="changeNav2('navDiv12','navTd13')" class="tab2_unselect2" id="navTd132">
                                 人员信息</td>
                            <td onclick="changeNav2('navDiv12','navTd13')" class="tab2_unselect3" id="navTd133">
                            </td>
                            <td onclick="changeNav2('navDiv12','navTd16')" class="tab2_unselect1" id="navTd161">
                            </td>
                            <td onclick="changeNav2('navDiv12','navTd16')" class="tab2_unselect2" id="navTd162">
                                 相关文档</td>
                            <td onclick="changeNav2('navDiv12','navTd16')" class="tab2_unselect3" id="navTd163">
                            </td>
                            <%} %>
                            <td class="tab2_right" width="*" align="right">
                                 <input type="button" value="保存"   class="com_btn2"   onclick="saveData()" />
                                 <input type="button" value="提交审批"   class="com_btn2"   onclick="saveData()" />
                                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                            </td>
                        </tr>
                    </table> 
                     
                      <table  cellspacing="0" cellpadding="0" width="100%" style="border-right: #9b9b9b 1px solid;
                        border-left: #9b9b9b 1px solid; border-bottom: #9b9b9b 1px solid" id="Table22"
                        border="0">
                        <tr>
                            <td height="0">
                            </td>
                        </tr>
                        <tr align="center">
                            <td valign="top">
                                <!--三部分内容-->
                                <div class="tab2_fim_div" id="navDiv10">
									 <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table11">
                        			<tr>
                        			 <td class="idt_main_m" valign="top">
                        			 	<div id="tdForm"> 
		                                    <table border="0" cellpadding="0" cellspacing="1" width="100%"   class="dg_borderstyle">
		                                       <tr>
		                                            <td class="fim_l" width="10%">项目名称(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"   >
		                                            <input type="text" name="projectname" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getProjectname()) %>" class="com_textbox" style="width:99%"/>
		                                             <input type="hidden" name="id" value="<%=obj==null?"":obj.getId() %>" class="com_textbox" style="width:99%"/>
		                                              <input type="hidden" name="url" value="<%=url%>" class="com_textbox" style="width:99%"/>
		                                            </td> 
		                                            <td class="fim_l" width="10%">项目组织单位(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"   >
		                                            <input type="text" name="projectorg" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getProjectorg()) %>" class="com_textbox" style="width:99%"/></td> 
		                                        </tr> 
		                                        <tr>
		                                            <td class="fim_l" width="10%">课题名称(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"  colspan="3">
		                                            <input type="text" name="subjectname" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getSubjectname()) %>" class="com_textbox" style="width:100%"/></td> 
		                                        </tr> 
		                                        <tr>
		                                            <td class="fim_l" width="10%">课题英文名称</td>
		                                            <td class="fim_r"   colspan="3">
		                                            <input type="text" name="subjectnameEn" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getSubjectnameEn()) %>" class="com_textbox" style="width:100%"/></td> 
		                                        </tr>  
		                                        <tr>
		                                            <td class="fim_l" width="10%">主题词</td>
		                                            <td class="fim_r"  colspan="3">
		                                            <input type="text" name="theme" value="<%=obj==null?"":StringUtilTool.NULL2Blank(obj.getTheme()) %>" class="com_textbox" style="width:100%"/></td> 
		                                        </tr> 
		                                         <tr>
		                                            <td class="fim_l" width="10%">课题来源(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"  > 
		                                           <input type="text" name="comeFrom" class="com_textbox" value="<%=oneTag==null?"":oneTag.getName()%>" style="width:99%" readonly="true"/> 
		                                           <input type="hidden" name="comeFromId" class="com_textbox" value="<%=oneTag==null?"":oneTag.getId()%>" style="width:99%" readonly="true"/>
		                                            </td> 
		                                             <td class="fim_l" width="10%">学科分级(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"  >
		                                             <input type="text" name="studyTag" class="com_textbox" value="<%=twoTag==null?"":twoTag.getName()%>" style="width:99%" readonly="true"/>
		                                             <input type="hidden" name="studyTagId" class="com_textbox" value="<%=twoTag==null?"":twoTag.getId()%>" style="width:99%" readonly="true"/>  
		                                             </td>
		                                        </tr> 
		                                        <tr>
		                                            <td class="fim_l" width="10%">研究方向(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"  > 
		                                           <input type="text" name="reasearchNav" class="com_textbox" value="<%=threeTag==null?"":threeTag.getName()%>" style="width:99%" readonly="true"/>
		                                            <input type="hidden" name="reasearchNavId" class="com_textbox" value="<%=threeTag==null?"":threeTag.getId()%>" style="width:99%" readonly="true"/>
		                                            </td> 
		                                             <td class="fim_l" width="10%">研究属性(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"  >
		                                             <input type="text" name="reasearchProp" class="com_textbox" value="<%=fourTag==null?"":fourTag.getName()%>" style="width:99%" readonly="true"/>
		                                             <input type="hidden" name="reasearchPropId" class="com_textbox" value="<%=fourTag==null?"":fourTag.getId()%>" style="width:99%" readonly="true"/> 
		                                             </td>
		                                        </tr>   
		                                        <tr>
		                                            <td class="fim_l" width="10%">申请时间(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"  > 
		                                           <input type="text" class="Wdate" id="applydate" value="<%=obj==null?Tools.getDateStr():Tools.getDateStringByDate(obj.getApplydate()) %>" style="width:99%" name="applydate"  onFocus="WdatePicker({el:'applydate',dateFmt:'yyyy-MM-dd'})" />
		                                            </td> 
		                                             <td class="fim_l" width="10%">中标时间</td>
		                                            <td class="fim_r"  >
		                                             <input type="text" class="Wdate" id="permitdate" value="<%=obj==null?"":Tools.getDateStringByDate(obj.getPermitdate()) %>" style="width:99%" name="permitdate"  onFocus="WdatePicker({el:'permitdate',dateFmt:'yyyy-MM-dd'})" /></td> 
		                                        </tr> 
		                                        <tr> 
		                                             <td class="fim_l" width="10%">申请经费(<font color="red">＊</font>)</td>
		                                            <td class="fim_r"  >
		                                            <input type="text" name="applyfund" id="applyfund" class="com_textbox" value="<%=obj==null?"":StringUtilTool.setObjNULLStr(obj.getApplyfund()) %>" style="width:99%"/></td> 
		                                            <td class="fim_l" width="10%">中标经费</td>
		                                            <td class="fim_r"  > 
		                                            <input type="text" name="permitfund" value="<%=obj==null?"":StringUtilTool.setObjNULLStr(obj.getPermitfund()) %>" class="com_textbox" style="width:99%"/></td> 
		                                        </tr> 
		                                        <tr> 
		                                             <td class="fim_l" width="10%">实获经费</td>
		                                            <td class="fim_r"  >
		                                            <input type="text" name="actualfund" class="com_textbox" value="<%=obj==null?"":StringUtilTool.setObjNULLStr(obj.getActualfund()) %>" style="width:99%"/></td> 
		                                            <td class="fim_l" width="10%">课题所属年份</td>
		                                            <td class="fim_r"  >
		                                            <input type="text" class="Wdate" id="belongyear" value="<%=obj==null?Tools.getYear():obj.getBelongyear() %>" style="width:99%" name="belongyear" style="width:200px" onFocus="WdatePicker({el:'belongyear',dateFmt:'yyyy'})" /></td>
		                                             
		                                        </tr> 
		                                        <tr>
		                                            <td class="fim_l" width="10%">计划开始时间</td>
		                                            <td class="fim_r"  >
		                                            <input type="text" class="Wdate" id="startdate" value="<%=obj==null?Tools.getDateStr():Tools.getDateStringByDate(obj.getStartdate()) %>" style="width:99%" name="startdate"  onFocus="WdatePicker({el:'startdate',dateFmt:'yyyy-MM-dd'})" />
		                                             </td> 
		                                             <td class="fim_l" width="10%">计划结束时间</td>
		                                            <td class="fim_r"  >
		                                            <input type="text" class="Wdate" id="enddate" value="<%=obj==null?Tools.getDateStr():Tools.getDateStringByDate(obj.getEnddate()) %>"" style="width:99%" name="enddate" style="width:200px" onFocus="WdatePicker({el:'enddate',dateFmt:'yyyy-MM-dd'})" />
		                                             </td> 
		                                        </tr> 
		                                        <tr>
		                                            <td class="fim_l" width="10%">课题概述(<font color="red">＊</font>)</td>
		                                            <td   colspan=3 width="100%">
		                                            	<textarea rows="22"  class="com_textarea" cols=""   style="background-color: #F9F2A5;"  name="abstractContent" style="width:100%;" ><%=obj==null?"":StringUtilTool.NULL2Blank(obj.getAbstractContent()) %></textarea>
		                                            </td>  
		                                        </tr>  
 
		                                    </table>   
                               			</div>
                        			 	</td>
                        			 	<td width="25%" height="100%" valign="top">
			                        		<iframe width="100%" height="100%"  name="tagTreeFrame" onload="this.height=tagTreeFrame.document.body.scrollHeight+10"   src="<%=path %>/tag/tagTree.jsp?idStr=<%=idStr%>"></iframe>
			                        	</td>
                                    </tr>
                          		  </table> 
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top">
                                <div class="tab2_fim_div" id="navDiv11" style="display: none">
									 <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table11">
                        			<tr>
                        			 <td class="idt_main_m" valign="top">
                        			 	<div id="tdForm"> 
		                                    <table border="0" cellpadding="0" cellspacing="1" width="100%"  class="dg_borderstyle">
		                                        
		                                        <tr>
		                                            <td class="fim_l" width="10%" valign="top">正文内容</td>
		                                            <td   colspan=3 >
		                                            	<textarea rows="80" class="com_textarea" cols=""   style="background-color: #F9F2A5;" name="content" style="width:100%" ><%=obj==null?"":StringUtilTool.NULL2Blank(obj.getContent()) %></textarea>
		                                            </td>  
		                                        </tr>  
		                                    </table>  
                               			</div>
                        			 	</td> 
                                    </tr>
                          		  </table> 
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" height="100%">
                                <div class="tab2_fim_div" id="navDiv12" style="display: none;">
									<iframe width="100%" height="100%"  name="tabContent" id="tabContent" frameborder="no" border="0" marginwidth="0" marginheight="0"  allowtransparency="yes" src=""></iframe>
                                </div>
                            </td>
                        </tr>
                    </table>
             	 </td>
              </tr>
           </table>
         </div> 
         </form>
</body>
</html>
